package ch.fusun.baron.farm;

import ch.fusun.baron.core.injection.Inject;
import ch.fusun.baron.data.DataUpdate;
import ch.fusun.baron.map.Tile;

/**
 * Sets the farm on the tile
 */
public class NewFarmDataUpdate implements DataUpdate {

	@Inject
	private transient FarmService farmService;
	private Tile tile;
	private Farm farm;

	/**
	 * Kryo
	 */
	public NewFarmDataUpdate() {
	}

	/**
	 * @param tile
	 *            The tile
	 * @param farm
	 *            The farm
	 */
	public NewFarmDataUpdate(Tile tile, Farm farm) {
		this.tile = tile;
		this.farm = farm;
	}

	@Override
	public void update() {
		farmService.setFarm(tile, farm);
	}

}
